
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Redis · GitBook笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="chenjiebin">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="kingbase.html" />
    
    
    <link rel="prev" href="mysql.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../document/kubernetes/kubernetes.html">
            
                <a href="../document/kubernetes/kubernetes.html">
            
                    
                    Kubernetes英文教程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../document/kubernetes/kubernetes.html">
            
                <a href="../document/kubernetes/kubernetes.html#concepts">
            
                    
                    Kubernetes Concepts
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../document/kubernetes/concepts/overview.html">
            
                <a href="../document/kubernetes/concepts/overview.html">
            
                    
                    Kubernetes Overview
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../document/kubernetes/concepts/components.html">
            
                <a href="../document/kubernetes/concepts/components.html">
            
                    
                    Kubernetes Components
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../document/kubernetes/concepts/nodes.html">
            
                <a href="../document/kubernetes/concepts/nodes.html">
            
                    
                    Kubernetes Nodes
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../document/kubernetes/kubernetes.html">
            
                <a href="../document/kubernetes/kubernetes.html#tutorial">
            
                    
                    Kubernetes Tutorial
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../document/kubernetes/tutorial/kubernetes-basics.html">
            
                <a href="../document/kubernetes/tutorial/kubernetes-basics.html">
            
                    
                    Kubernetes Basics
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../java/java.html">
            
                <a href="../java/java.html">
            
                    
                    Java基础知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../java/java-summary.html">
            
                <a href="../java/java-summary.html">
            
                    
                    Java_Summary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../java/java-jvm.html">
            
                <a href="../java/java-jvm.html">
            
                    
                    Java_JVM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../java/effectiveJava.html">
            
                <a href="../java/effectiveJava.html">
            
                    
                    effectiveJava
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../java/design-pattern.html">
            
                <a href="../java/design-pattern.html">
            
                    
                    设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../java/JavaTest.html">
            
                <a href="../java/JavaTest.html">
            
                    
                    JavaTest
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../java/myframe.html">
            
                <a href="../java/myframe.html">
            
                    
                    MyFrame
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="database.html">
            
                <a href="database.html">
            
                    
                    数据库基础知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="mysql.html">
            
                <a href="mysql.html">
            
                    
                    MySQL
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4.2" data-path="redis.html">
            
                <a href="redis.html">
            
                    
                    Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="kingbase.html">
            
                <a href="kingbase.html">
            
                    
                    KingBase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="polardb.html">
            
                <a href="polardb.html">
            
                    
                    PolarDB
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../system/system.html">
            
                <a href="../system/system.html">
            
                    
                    环境配置工具
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../system/nodejs.html">
            
                <a href="../system/nodejs.html">
            
                    
                    Node.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../system/gitbook.html">
            
                <a href="../system/gitbook.html">
            
                    
                    Gitbook
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../system/linux.html">
            
                <a href="../system/linux.html">
            
                    
                    Linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../system/kylin.html">
            
                <a href="../system/kylin.html">
            
                    
                    麒麟系统
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../tool/tool.html">
            
                <a href="../tool/tool.html">
            
                    
                    开发工具介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../tool/docker.html">
            
                <a href="../tool/docker.html">
            
                    
                    Docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../tool/idea.html">
            
                <a href="../tool/idea.html">
            
                    
                    Idea
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../tool/maven.html">
            
                <a href="../tool/maven.html">
            
                    
                    Maven
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../tool/gradle.html">
            
                <a href="../tool/gradle.html">
            
                    
                    Gradle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../framework/kubernate.html">
            
                <a href="../framework/kubernate.html">
            
                    
                    Kubernetes
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >Redis</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#&#x6982;&#x8FF0;"><b>1. </b>&#x6982;&#x8FF0;</a></li><li><span class="title-icon "></span><a href="#&#x6570;&#x636E;&#x7C7B;&#x578B;"><b>2. </b>&#x6570;&#x636E;&#x7C7B;&#x578B;</a></li><li><span class="title-icon "></span><a href="#&#x6301;&#x4E45;&#x5316;"><b>3. </b>&#x6301;&#x4E45;&#x5316;</a></li><li><span class="title-icon "></span><a href="#&#x5E38;&#x89C1;&#x95EE;&#x9898;"><b>4. </b>&#x5E38;&#x89C1;&#x95EE;&#x9898;</a></li><ul><li><span class="title-icon "></span><a href="#&#x7F13;&#x5B58;&#x51FB;&#x7A7F;"><b>4.1. </b>&#x7F13;&#x5B58;&#x51FB;&#x7A7F;</a></li><li><span class="title-icon "></span><a href="#&#x7F13;&#x5B58;&#x96EA;&#x5D29;"><b>4.2. </b>&#x7F13;&#x5B58;&#x96EA;&#x5D29;</a></li></ul><li><span class="title-icon "></span><a href="#idea"><b>5. </b>IDEA</a></li><li><span class="title-icon "></span><a href="#&#x53C2;&#x8003;"><b>6. </b>&#x53C2;&#x8003;</a></li></ul></div><a href="#&#x6982;&#x8FF0;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="&#x6982;&#x8FF0;"><a name="&#x6982;&#x8FF0;" class="anchor-navigation-ex-anchor" href="#&#x6982;&#x8FF0;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x6982;&#x8FF0;</h1>
<p>Redis&#x662F;&#x5F00;&#x6E90;&#x514D;&#x8D39;&#x7684;&#x7075;&#x6D3B;&#x7684;&#x9AD8;&#x6027;&#x80FD;key-value&#x6570;&#x636E;&#x7ED3;&#x6784;&#x5B58;&#x50A8;&#xFF0C;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x6570;&#x636E;&#x5E93;&#x3001;&#x7F13;&#x5B58;&#x548C;&#x6D88;&#x606F;&#x961F;&#x5217;</p>
<ul>
<li>&#x652F;&#x6301;&#x6570;&#x636E;&#x7684;&#x6301;&#x4E45;&#x5316;&#xFF0C;&#x5C06;&#x5185;&#x5B58;&#x4E2D;&#x7684;&#x6570;&#x636E;&#x4FDD;&#x5B58;&#x5230;&#x78C1;&#x76D8;&#x4E2D;</li>
<li>&#x652F;&#x6301;key-value&#xFF0C;list&#xFF0C;set&#xFF0C;zset&#xFF0C;hash&#x7B49;&#x6570;&#x636E;&#x7ED3;&#x6784;</li>
<li>&#x652F;&#x6301;&#x4E3B;&#x4ECE;&#x590D;&#x5236;&#xFF0C;&#x5373;master-slave&#x6A21;&#x5F0F;&#x7684;&#x6570;&#x636E;&#x5907;&#x4EFD;</li>
</ul>
<p>Redis&#x7ECF;&#x5E38;&#x7528;&#x6765;&#x505A;&#x5206;&#x5E03;&#x5F0F;&#x9501;&#x3002;Redis&#x652F;&#x6301;&#x4E8B;&#x52A1;&#x3001;&#x6301;&#x4E45;&#x5316;&#x3001;LUA&#x811A;&#x672C;&#x3001;LRU&#x9A71;&#x52A8;&#x4E8B;&#x4EF6;&#x3001;&#x591A;&#x79CD;&#x96C6;&#x7FA4;&#x65B9;&#x6848;</p>
<h1 id="&#x6570;&#x636E;&#x7C7B;&#x578B;"><a name="&#x6570;&#x636E;&#x7C7B;&#x578B;" class="anchor-navigation-ex-anchor" href="#&#x6570;&#x636E;&#x7C7B;&#x578B;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x6570;&#x636E;&#x7C7B;&#x578B;</h1>
<ul>
<li>&#x5B57;&#x7B26;&#x4E32;&#xFF08;string&#xFF09;&#xFF0C;&#x5355;&#x4E2A;&#x6570;&#x636E;&#x5B58;&#x50A8;&#x6700;&#x5927;&#x7A7A;&#x95F4;&#x662F;512M</li>
<li>&#x54C8;&#x5E0C;&#xFF08;hash&#xFF09;&#xFF0C;&#x6BCF;&#x4E2A;&#x54C8;&#x5E0C;&#x53EF;&#x4EE5;&#x5B58;&#x50A8;&#x591A;&#x8FBE;2^32-1&#x4E2A;&#x952E;-&#x503C;&#x5BF9;</li>
<li>&#x5217;&#x8868;&#xFF08;list&#xFF09;&#xFF0C;&#x6309;&#x63D2;&#x5165;&#x987A;&#x5E8F;&#x6392;&#x5E8F;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06;&#x5143;&#x7D20;&#x6DFB;&#x52A0;&#x5230;redis&#x5934;&#x90E8;&#x6216;&#x5C3E;&#x90E8;</li>
<li>&#x96C6;&#x5408;&#xFF08;set&#xFF09;&#xFF0C;&#x96C6;&#x5408;&#x4E2D;&#x7684;&#x6700;&#x5927;&#x6210;&#x5458;&#x6570;&#x4E3A;2^32-1&#x4E2A;&#x5143;&#x7D20;</li>
<li>&#x6709;&#x5E8F;&#x96C6;&#x5408;&#xFF08;sorted set&#xFF09;&#xFF0C;&#x975E;&#x91CD;&#x590D;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x96C6;&#x5408;&#xFF0C;&#x4E0E;score&#xFF08;&#x53EF;&#x91CD;&#x590D;&#xFF09;&#x5173;&#x8054;</li>
<li>&#x4F4D;&#x56FE;&#xFF08;Bitmaps&#xFF09;</li>
<li>&#x57FA;&#x6570;&#x7EDF;&#x8BA1;&#xFF08;HyperLogLogs&#xFF09;</li>
</ul>
<pre class="language-"><code class="lang-bash"><span class="token comment"># &#x542F;&#x52A8;redis</span>
<span class="token operator">&gt;</span> redis-server <span class="token punctuation">[</span>--port <span class="token number">6379</span><span class="token punctuation">]</span>
<span class="token operator">&gt;</span> redis-server <span class="token punctuation">[</span>xx/xx/redis.conf<span class="token punctuation">]</span>
<span class="token comment"># &#x8FDE;&#x63A5;redis</span>
<span class="token operator">&gt;</span> redis-cli <span class="token punctuation">[</span>-h <span class="token number">127.0</span>.0.1 <span class="token parameter variable">-p</span> <span class="token number">6379</span><span class="token punctuation">]</span>
<span class="token comment"># &#x505C;&#x6B62;redis</span>
<span class="token operator">&gt;</span> redis-cli <span class="token function">shutdown</span>
<span class="token operator">&gt;</span> <span class="token function">kill</span> redis-pid
<span class="token comment"># &#x5207;&#x6362;&#x6570;&#x636E;&#x5E93;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> <span class="token keyword">select</span> <span class="token number">1</span>
<span class="token comment"># &#x83B7;&#x53D6;&#x6240;&#x6709;key</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> keys *
<span class="token comment"># &#x83B7;&#x53D6;key&#x603B;&#x6570;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> dbsize
<span class="token comment"># &#x67E5;&#x8BE2;&#x952E;&#x662F;&#x5426;&#x5B58;&#x5728;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> exists key <span class="token punctuation">[</span>key <span class="token punctuation">..</span>.<span class="token punctuation">]</span>
<span class="token comment"># &#x5220;&#x9664;key</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> del key <span class="token punctuation">[</span>key <span class="token punctuation">..</span>.<span class="token punctuation">]</span>
<span class="token comment"># &#x67E5;&#x8BE2;key&#x7C7B;&#x578B;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> <span class="token builtin class-name">type</span> key
<span class="token comment"># &#x79FB;&#x52A8;key</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> move key db
<span class="token comment"># &#x67E5;&#x8BE2;key&#x7684;&#x751F;&#x547D;&#x5468;&#x671F;&#xFF08;&#x79D2;&#xFF09;&#xFF0C;-1&#xFF1A;&#x6C38;&#x4E0D;&#x8FC7;&#x671F;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> ttl key
<span class="token comment"># &#x8BBE;&#x7F6E;&#x8FC7;&#x671F;&#x65F6;&#x95F4;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> expire key seconds
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> expire key milliseconds
<span class="token comment"># &#x8BBE;&#x7F6E;&#x6C38;&#x4E0D;&#x8FC7;&#x671F;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> persist key
<span class="token comment"># &#x66F4;&#x6539;key&#x540D;&#x79F0;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> <span class="token function">rename</span> key newkey
<span class="token comment"># &#x6570;&#x503C;&#x9012;&#x589E;/&#x9012;&#x51CF;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> incr key

<span class="token comment"># &#x64CD;&#x4F5C;&#x5B57;&#x7B26;&#x4E32;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> <span class="token builtin class-name">set</span> content <span class="token string">&quot;this is message.&quot;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> get content
<span class="token comment"># &#x6279;&#x91CF;&#x5B58;&#x653E;&#x952E;&#x503C;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> mset key value <span class="token punctuation">[</span>key value <span class="token punctuation">..</span>.<span class="token punctuation">]</span>
<span class="token comment"># &#x83B7;&#x53D6;&#x503C;&#x957F;&#x5EA6;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> strlen key
<span class="token comment"># &#x8FFD;&#x52A0;&#x5185;&#x5BB9;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> append key value
<span class="token comment"># &#x83B7;&#x53D6;&#x90E8;&#x5206;&#x5B57;&#x7B26;&#x4E32;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> getrange key start end

<span class="token comment"># &#x64CD;&#x4F5C;Hash</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> hmset user:1 username jack password javapoint alexa <span class="token number">2000</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> hgetall user:1
<span class="token comment"># &#x64CD;&#x4F5C;&#x5217;&#x8868;&#xFF0C;&#x6309;&#x63D2;&#x5165;&#x987A;&#x5E8F;&#x6392;&#x5E8F;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> lpush testlist <span class="token function">java</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> lpush testlist sql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> lpush testlist mongdb
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> lpush testlist cassandra
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> lrange testlist <span class="token number">0</span> <span class="token number">10</span>
<span class="token comment"># &#x64CD;&#x4F5C;&#x96C6;&#x5408;&#xFF0C;&#x65E0;&#x5E8F;&#x4E0D;&#x91CD;&#x590D;&#x5B57;&#x7B26;&#x4E32;&#x96C6;&#x5408;&#xFF0C;&#x65F6;&#x95F4;&#x590D;&#x6742;&#x5EA6;&#x662F;O(1)</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> sadd testset redis
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> sadd testset sql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> sadd testset postgresql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> sadd testset postgresql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> sadd testset postgresql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> smembers testset
<span class="token comment"># &#x64CD;&#x4F5C;&#x6709;&#x5E8F;&#x96C6;&#x5408;</span>
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> zadd testzset <span class="token number">0</span> redis
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> zadd testzset <span class="token number">0</span> sql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> zadd testzset <span class="token number">0</span> postgresql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> zadd testzset <span class="token number">0</span> postgresql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> zadd testzset <span class="token number">0</span> postgresql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> zadd testzset <span class="token number">0</span> postgresql
<span class="token number">127.0</span>.0.1:637<span class="token operator"><span class="token file-descriptor important">9</span>&gt;</span> zrangebyscore testzset <span class="token number">0</span> <span class="token number">10</span>
</code></pre>
<h1 id="&#x6301;&#x4E45;&#x5316;"><a name="&#x6301;&#x4E45;&#x5316;" class="anchor-navigation-ex-anchor" href="#&#x6301;&#x4E45;&#x5316;"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x6301;&#x4E45;&#x5316;</h1>
<p>&#x6301;&#x4E45;&#x5316;&#x5C31;&#x662F;&#x5C06;&#x5185;&#x5B58;&#x4E2D;&#x7684;&#x6570;&#x636E;&#x5199;&#x5230;&#x78C1;&#x76D8;&#x4E2D;&#xFF0C;&#x9632;&#x6B62;&#x670D;&#x52A1;&#x5668;&#x5B95;&#x673A;&#x540E;&#x5185;&#x5B58;&#x6570;&#x636E;&#x4E22;&#x5931;</p>
<blockquote>
<p>RDB&#xFF1A;Redis DataBase</p>
</blockquote>
<p>rdbSave&#xFF1A;&#x4ECE;&#x5185;&#x5B58;&#x6570;&#x636E;&#x751F;&#x6210;RDB&#x6587;&#x4EF6;</p>
<p>rdbLoad&#xFF1A;&#x4ECE;RDB&#x6587;&#x4EF6;&#x52A0;&#x8F7D;&#x5230;&#x5185;&#x5145;&#x4E2D;</p>
<blockquote>
<p>AOF&#xFF1A;Append-only file</p>
</blockquote>
<h1 id="&#x5E38;&#x89C1;&#x95EE;&#x9898;"><a name="&#x5E38;&#x89C1;&#x95EE;&#x9898;" class="anchor-navigation-ex-anchor" href="#&#x5E38;&#x89C1;&#x95EE;&#x9898;"><i class="fa fa-link" aria-hidden="true"></i></a>4. &#x5E38;&#x89C1;&#x95EE;&#x9898;</h1>
<h2 id="&#x7F13;&#x5B58;&#x51FB;&#x7A7F;"><a name="&#x7F13;&#x5B58;&#x51FB;&#x7A7F;" class="anchor-navigation-ex-anchor" href="#&#x7F13;&#x5B58;&#x51FB;&#x7A7F;"><i class="fa fa-link" aria-hidden="true"></i></a>4.1. &#x7F13;&#x5B58;&#x51FB;&#x7A7F;</h2>
<p>key&#x5931;&#x6548;&#x6216;&#x4E0D;&#x5B58;&#x5728;&#xFF08;&#x6076;&#x610F;&#x8BF7;&#x6C42;&#x7684;&#x65E0;&#x6548;key&#xFF09;&#x65F6;&#xFF0C;&#x5927;&#x91CF;&#x8BF7;&#x6C42;&#x76F4;&#x63A5;&#x8BBF;&#x95EE;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x9020;&#x6210;&#x670D;&#x52A1;&#x5D29;&#x6E83;</p>
<ul>
<li>&#x6821;&#x9A8C;&#x975E;&#x5408;&#x6CD5;&#x6570;&#x636E;</li>
<li>&#x5BF9;&#x7A7A;&#x503C;&#x8FDB;&#x884C;&#x6682;&#x65F6;&#xFF08;&#x5931;&#x6548;&#x8F83;&#x77ED;&#xFF09;&#x7F13;&#x5B58;</li>
</ul>
<h2 id="&#x7F13;&#x5B58;&#x96EA;&#x5D29;"><a name="&#x7F13;&#x5B58;&#x96EA;&#x5D29;" class="anchor-navigation-ex-anchor" href="#&#x7F13;&#x5B58;&#x96EA;&#x5D29;"><i class="fa fa-link" aria-hidden="true"></i></a>4.2. &#x7F13;&#x5B58;&#x96EA;&#x5D29;</h2>
<p>Redis&#x4E2D;&#x67D0;&#x4E2A;&#x65F6;&#x95F4;&#x70B9;&#x5927;&#x91CF;key&#x5931;&#x6548;&#x65F6;&#xFF0C;&#x5927;&#x91CF;&#x8BF7;&#x6C42;&#x76F4;&#x63A5;&#x8BBF;&#x95EE;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x9020;&#x6210;&#x670D;&#x52A1;&#x5D29;&#x6E83;</p>
<ul>
<li>&#x7F13;&#x5B58;&#x5931;&#x6548;&#x540E;&#xFF0C;&#x52A0;&#x9501;&#x6216;&#x8BBE;&#x7F6E;&#x7B49;&#x5F85;&#x961F;&#x5217;&#x6765;&#x63A7;&#x5236;&#x8BFB;&#x53D6;&#x7F13;&#x5B58;&#x7684;&#x7EBF;&#x7A0B;&#x6570;&#x91CF;</li>
<li>&#x505A;&#x4E8C;&#x7EA7;&#x7F13;&#x5B58;&#xFF0C;A1&#x4E3A;&#x7F13;&#x5B58;&#xFF0C;A2&#x4F4D;&#x957F;&#x671F;&#x7F13;&#x5B58;&#xFF0C;A1&#x5931;&#x6548;&#x540E;&#x8BBF;&#x95EE;A2</li>
<li>&#x4E0D;&#x540C;&#x7684;key&#x8BBE;&#x7F6E;&#x4E0D;&#x540C;&#x7684;&#x8FC7;&#x671F;&#x65F6;&#x95F4;&#xFF0C;&#x8BA9;&#x7F13;&#x5B58;&#x5931;&#x6548;&#x65F6;&#x95F4;&#x70B9;&#x5747;&#x5300;&#x5206;&#x5E03;</li>
</ul>
<h1 id="idea"><a name="idea" class="anchor-navigation-ex-anchor" href="#idea"><i class="fa fa-link" aria-hidden="true"></i></a>5. IDEA</h1>
<ul>
<li><p>&#x5B89;&#x88C5;&#x63D2;&#x4EF6;iedis</p>
</li>
<li><p>&#x66FF;&#x6362;config\plugins\Iedis 2\lib\iedis-x.x.x.jar</p>
</li>
<li>&#x70B9;&#x51FB;&#x53F3;&#x4FA7;RedisServer&#x5EFA;&#x7ACB;&#x94FE;&#x63A5;</li>
<li>&#x6253;&#x5F00;&#x63A7;&#x5236;&#x53F0;&#x8FDB;&#x884C;&#x64CD;&#x4F5C;</li>
</ul>
<h1 id="&#x53C2;&#x8003;"><a name="&#x53C2;&#x8003;" class="anchor-navigation-ex-anchor" href="#&#x53C2;&#x8003;"><i class="fa fa-link" aria-hidden="true"></i></a>6. &#x53C2;&#x8003;</h1>
<p><a href="https://www.redis.com.cn/" target="_blank">Redis&#x4E2D;&#x6587;&#x7F51; - Redis&#x5F00;&#x53D1;&#x4E0E;&#x8FD0;&#x7EF4;&#x6280;&#x672F;&#x3001;Redis&#x6559;&#x7A0B;&#x3001;&#x4F7F;&#x7528;&#x624B;&#x518C;</a></p>
<p><a href="https://www.cnblogs.com/arxive/p/9301512.html" target="_blank">Redis&#x7684;&#x5B89;&#x88C5;&#x4E0E;idea&#x4E2D;&#x7684;&#x4F7F;&#x7528; - wenglabs - &#x535A;&#x5BA2;&#x56ED; (cnblogs.com)</a></p>
<p><a href="https://www.redis.com.cn/redis-interview-questions.html" target="_blank">redis&#x9762;&#x8BD5;&#x9898;</a></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="mysql.html" class="navigation navigation-prev " aria-label="Previous page: MySQL">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="kingbase.html" class="navigation navigation-next " aria-label="Next page: KingBase">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Redis","level":"1.4.2","depth":2,"next":{"title":"KingBase","level":"1.4.3","depth":2,"path":"markdown/database/kingbase.md","ref":"markdown/database/kingbase.md","articles":[]},"previous":{"title":"MySQL","level":"1.4.1","depth":2,"path":"markdown/database/mysql.md","ref":"markdown/database/mysql.md","articles":[]},"dir":"ltr"},"config":{"plugins":["theme-default","prism","-highlight","search-pro","-search","-lunr","expandable-chapters-small","splitter","-sharing","anchor-navigation-ex","code"],"styles":{"ebook":"styles/ebook.css","epub":"styles/epub.css","mobi":"styles/mobi.css","pdf":"styles/pdf.css","print":"styles/print.css","website":"styles/website.css"},"pluginsConfig":{"prism":{},"search-pro":{},"expandable-chapters-small":{},"splitter":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"code":{"copyButtons":true},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"showLevel":false,"styles":{"ebook":"styles/ebook.css","epub":"styles/epub.css","mobi":"styles/mobi.css","pdf":"styles/pdf.css","print":"styles/print.css","website":"styles/website.css"}}},"theme":"default","author":"chenjiebin","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pluginConfig":{"prism":{"css":["prismjs/themes/prism-solarizedlight.css"]},"anchor-navigation-ex":{"showLevel":true},"theme-default":{"toggleMenu":false}},"variables":{},"title":"GitBook笔记","gitbook":"*","description":"学习笔记，包含前后端基础知识及框架的学习笔记"},"file":{"path":"markdown/database/redis.md","mtime":"2023-11-19T13:43:04.076Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2024-02-28T09:32:04.838Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

